package com.zl.net
{
	import cn.skyclass.events.EventNotification;
	import cn.skyclass.events.GlobalTipEvent;
	import cn.skyclass.net.RoFactory;
	
	import mx.managers.CursorManager;
	
	public class MyRoFactory extends RoFactory
	{
		private static var _instance:MyRoFactory = null;
		
		public static function getInstance():MyRoFactory{
			if(_instance == null) {
				_instance = new MyRoFactory();
			}
			return _instance;
		}
		
		/**
		 * 用于向外发布正在操作的提示信息
		 * 使用默认的 EventNotification
		 */
		public var enInstanceName:String = EventNotification.DEFAULT_INSTANCE_NAME;
		
		protected function get en():EventNotification{
			return EventNotification.getInstance(this.enInstanceName);
		}
		
		override protected function beginCall(status:String):void {
			CursorManager.setBusyCursor();
			this.en.dispatchEvent(new GlobalTipEvent(GlobalTipEvent.START_TIP, "正在" + status + ", 请稍候"));
		}
		
		override protected function callSuccess(status:String):void {
			CursorManager.removeBusyCursor();
			this.en.dispatchEvent(new GlobalTipEvent(GlobalTipEvent.END_TIP, "正在" + status + ", 请稍候"));
		}
		override protected function callFail(status:String):void  {
			CursorManager.removeBusyCursor();
			this.en.dispatchEvent(new GlobalTipEvent(GlobalTipEvent.END_TIP, "正在" + status + ", 请稍候"));
			this.en.dispatchEvent(new GlobalTipEvent(GlobalTipEvent.TEMP_TIP, status + "失败!"));
		}
		
	}
}